package com.qf.exception;


import com.qf.utils.Mycode;
import com.qf.utils.ResultMsg;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Component
@ResponseBody
public class MyException {

    @ExceptionHandler(NullPointerException.class)
    public ResultMsg err(RuntimeException e){
        return ResultMsg.ERROR(Mycode.NULL_ERRO,"空指针异常"+e.getMessage());
    }
}
